﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SaleLibrary.Tools;
using NHibernate;
using BrokerBase.Lib.Client;

namespace SaleLibrary.License
{
    public class ActiveCodeReg
    {
        /// <summary>
        /// 读取与终端硬件信息全部匹配的注册信息
        /// </summary>
        /// <param name="info"></param>
        /// <param name="sess"></param>
        /// <returns></returns>
        public static IList<ActiveCodeReg> LoadByTerminalInfoWithAllMatch(TerminalInfo info,ISession sess)
        {
            string hql = "from ActiveCodeReg where DISKSerialNo='" + info.DISKSerialNo + "' and MACSerialNo='" + info.MACSerialNo + "' and MBSerialNo='" + info.MBSerialNo + "'";
            IList<ActiveCodeReg> regs = sess.CreateQuery(hql).List<ActiveCodeReg>();

            return regs;
        }
        /// <summary>
        /// 主键
        /// </summary>
        public virtual int Id { get; set; }
        /// <summary>
        /// 注册时间
        /// </summary>
        public virtual DateTime RegTime { get; set; }
        /// <summary>
        /// 关联的激活码
        /// </summary>
        public virtual ActiveCode ActiveCode { get; set; }
        /// <summary>
        /// 赢盘序列号
        /// </summary>
        public virtual string DISKSerialNo { get; set; }
        /// <summary>
        /// 网卡Mac地址
        /// </summary>
        public virtual string MACSerialNo { get; set; }
        /// <summary>
        /// 主板序列号
        /// </summary>
        public virtual string MBSerialNo { get; set; }
        /// <summary>
        /// 操作系统
        /// </summary>
        public virtual string OSVersion { get; set; }
        /// <summary>
        /// 注册时的ip地址
        /// </summary>
        public virtual string RegIPAddress { get; set; }
        /// <summary>
        /// 注册时的地理位置
        /// </summary>
        public virtual string RegDistrict { get; set; }

    }
}
